// Mongoose是用js编写 Mongoose导出是用module.exports导出 所以要在tsconfig.ts中填写"esModuleInterop": true
import Mongoose from "mongoose";
import { Movie } from "../entities/Movie";

export interface IMovie extends Movie, Mongoose.Document { }

// tslint开发规范每一个属性后加一个, 取消用 "trailing-comma":false
const movieSchema = new Mongoose.Schema<IMovie>({
    name: String,
    types: [String],
    areas: [String],
    timeLong: Number,
    isHot: Boolean,
    isComing: Boolean,
    isClassic: Boolean,
    description: String,
    poster: String
}, {
    versionKey: false
});

export default Mongoose.model<IMovie>("Movie", movieSchema);
